#include <iostream>
#include <vector>
#include <boost/assign.hpp>
#include <boost/iterator/iterator_facade.hpp>
using namespace std;
using namespace boost::assign;
/*
template <
      class Derived             // The derived iterator type being constructed
    , class Value
    , class CategoryOrTraversal
    , class Reference   = Value&
    , class Difference  = std::ptrdiff_t
  >
*/
template<typename T>
class vs_iterator 
    : public boost::iterator_facade<
      vs_iterator<T>, T,
      boost::single_pass_traversal_tag
      >
{
private:
    std::vector<T> &v;
    size_t current_pos;
public:
    vs_iterator(vector<T> &_v, size_t pos = 0) :
        v(_v), current_pos(pos)
    {}
    vs_iterator(vs_iterator<T> const & other):
        v(other.v), current_pos(other.current_pos)
    {}
    void operator=(vs_iterator<T> const &other)
    {
        this->v = other.v; 
        this->current_pos = other.current_pos;
    }
private:
    friend class boost::iterator_core_access;

    reference dereference() const
    {   return v[current_pos]; }
    void increment()
    {   ++ current_pos; }
    bool equal(vs_iterator<T> const & other) const
    {
        return this->current_pos == other.current_pos;
    }
};

int main()
{
    cout << "--- Start ---" << endl;
    vector<int> vec;
    vec += 32, 44, 54, 12, 100, 79, 32, 12, 23;
    vs_iterator<int> iter(vec);
    cout << "--- End ---" << endl;
    return 0;
}
